﻿using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Folder = OMC.DataManagement.Folder;
using MailContent = OMC.DataManagement.MailContent;

namespace OMC.Utils
{
    /// <summary>
    /// this is a static class.
    /// this class is only used for debugging
    /// </summary>
    /// <remarks>
    /// Copyright 2012 Stefan Lütolf
    /// </remarks>
    static class Debug
    {
        //Debug could be activated (status = on) or disactivated (status = off)
        private static bool TheStatus = On;

        private const bool On = true;
        private const bool Off = false;

        /// <summary>
        /// to show a Messagebox with Text: "Here"
        /// </summary>
        public static void here()
        {
            if (TheStatus)
            {
                MessageBox.Show("----HERE----");
            }
        }

        /// <summary>
        /// to show a MessageBox with a custom String
        /// </summary>
        /// <param name="inString">custom String</param>
        public static void print(string inString)
        {
            if (TheStatus)
            {
                MessageBox.Show(inString);
            }
        }

        /// <summary>
        /// to show a messageBox with a String of a StringBuilder
        /// The Stringbuilder doesn't have to convert to String
        /// </summary>
        /// <param name="inBuilder">a StringBuilder</param>
        public static void print(StringBuilder inBuilder)
        {
            if (TheStatus)
            {
                print(inBuilder.ToString());
            }
        }

        /// <summary>
        /// to print a List, which contain objects of Folder Type
        /// </summary>
        /// <param name="inList">List which contain objects of Folder Type</param>
        public static void print(ref List<Folder> inList)
        {
            if (TheStatus)
            {
                StringBuilder TheStringBuilder = new StringBuilder();
                TheStringBuilder.AppendLine("Liste");
                foreach (Folder TheFolder in inList)
                {
                    TheStringBuilder.AppendFormat("*Folder: {0}, (Path: {1})\n", TheFolder.TheFolderName, TheFolder.FolderInfo);
                    foreach (MailContent TheMailContent in TheFolder)
                    {
                        TheStringBuilder.AppendLine("\t\t <Mailcontent>");
                    }
                }
                print(TheStringBuilder);
            }
        }
    }
}